{% extends 'base.html' %}
{% load url from future %}

{% block java_script %}
<script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
        $('.clientlist').dataTable({
            "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
            "iDisplayLength": 20,
            "aLengthMenu": [[20, 50, -1], [20, 50, "All"]],
            "sPaginationType": "bootstrap",
            "bStateSave": true,
            "aaSorting": [[0,'asc']]
        });
    } );
</script>
{% endblock %}

{% block content %}

<div class="row-fluid">
<div class="span1">
  <img  src='https://km.support.apple.com.edgekey.net/kb/securedImage.jsp?configcode={{machine.serial_number|slice:"8:" }}&size=72x72' />
</div>
  <div class="span10">
    <h2>{{ machine.hostname }}</h2>
    {% if model_lookup_enabled and additional_info.model_description|length > 1 %}
      <h3><small>{{ additional_info.model_description }}</small></h3>
    {% endif %}
    <p>
      <a href='{% url "reports.views.detail" machine.mac %}'>Report</a> | <b>Inventory</b>
      <span title="Last inventory date">
              :: {{ machine.last_inventory_update|date:"Y-m-d H:i" }}
      </span>
    </p>
  </div>
</div>

<div class="row-fluid">
  <div class="span6">
      <h3>Machine info</h3>
      <table class="client_info table table-condensed">
        <tbody>
          <tr>
            <th>MAC:</th>
            <td>{{ machine.mac }}</td>
          </tr>
          <tr>
            <th>Username:</th>
            <td>{{ machine.username }}</td>
          </tr>
          <tr>
            <th>Location:</th>
            <td>{{ machine.location }}</td>
          </tr>
          <tr>
            <th>Last inventory date:</th>
            <td>{{ machine.last_inventory_update|date:"Y-m-d H:i" }}</td>
          </tr>
        </tbody>
      </table>
  </div>
  <div class="span6">
      <h3>&nbsp;</h3>
      <table class="client_info table table-condensed"">
        <tbody>
          <tr>
            <th>Model:</th>
            <td>
              {{ machine.machine_model }}
              {{ machine.cpu_type }}
              {{ machine.cpu_speed}}
            </td>
          </tr>
          <tr>
            <th>RAM:</th>
            <td>{{ machine.ram }}</td>
          </tr>
          <tr>
            <th>Serial:</th>
            <td>{{ machine.serial_number }}</td>
          </tr>
          <tr>
            <th>OS version:</th>
            <td>{{ machine.os_version }}
                {{ machine.cpu_arch }}</td>
          </tr>
        </tbody>
      </table>
  </div>
</div>
<p/>
{% with inventory_items=inventory_items list_title='Application inventory' %}
  {% include 'inventory/inventorytable.html' %}
{% endwith %}
{% endblock %}
